import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:new_yuqib_app/yqbView/loading_view.dart';
import 'package:webview_flutter/webview_flutter.dart';

import 'controller.dart';

class WebView extends StatelessWidget {
  final int typeId;

  const WebView({super.key, required this.typeId});

  @override
  Widget build(BuildContext context) {
    final logic = Get.put(WebController(typeId));
    return Scaffold(
      appBar: AppBar(
        leading: const CupertinoNavigationBarBackButton(color: Colors.black),
        title: Text(typeId > 0 ? "隐私政策" : "用户协议"),
        centerTitle: true,
      ),
      body: Obx(() {
        return LoadingView(
            loadingType: logic.loadingType.value,
            builder: (context) {
              return WebViewWidget(controller: logic.webView.value);
            });
      }),
    );
  }
}
